
package com.seekting.study;

import java.util.ArrayList;
import java.util.List;

import com.google.gson.Gson;

public class NewsCategory {

    private static final int STATE_ADDED = 1;
    private static final int STATE_REMOVED = 0;

    private int cid;
    private String cname;
    /**
     * 默认上还是不上
     */
    private int state;

    private boolean closeable;

    public int getCid() {
        return cid;
    }

    public void setCid(int cid) {
        this.cid = cid;
    }

    public String getCname() {
        return cname;
    }

    public void setCname(String cname) {
        this.cname = cname;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public static void main(String[] args) {
        List<NewsCategory> list = new ArrayList<NewsCategory>();
        for (int i = 0; i < 4; i++) {
            NewsCategory newsCategory = new NewsCategory();
            newsCategory.setCid(i);
            newsCategory.setCname("name" + i);
            newsCategory.setCloseable(Math.random() < 0.5f);
            int state = (int) (3 * Math.random());
            newsCategory.setState(state);
            list.add(newsCategory);
        }
        Gson gson = new Gson();
        String xx = gson.toJson(list);
        System.out.println(xx);
    }

    public boolean isCloseable() {
        return closeable;
    }

    public void setCloseable(boolean closeable) {
        this.closeable = closeable;
    }
}
